package com.smartleanx.module.hrm.controller.app.examine;

import com.alibaba.fastjson2.JSONObject;
import com.smartleanx.framework.common.pojo.CommonResult;
import com.smartleanx.module.hrm.service.examine.examinSon.ExamineService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

import static com.smartleanx.framework.common.pojo.CommonResult.success;

@Tag(name = "app - 考核计划")
@RestController
@RequestMapping("/hrm/examine")
@Validated
public class ExamineAppController {
    @Resource
    private ExamineService examineService;


    /**
     * app端确认详情
     */
    @GetMapping("/selectLaunchResultExamineInfoById")
    public CommonResult<Object> selectLaunchResultExamineInfoById(@RequestParam("examineId") Integer examineId) {
        JSONObject jsonObject = examineService.selectLaunchResultExamineInfoById(examineId);
        return CommonResult.success(jsonObject);
    }

    /**
     * app端列表
     */
    @GetMapping("/selectLaunchResultList")
    public CommonResult<Object> selectLaunchResultList() {
        List<JSONObject> jsonObjects = examineService.selectLaunchResultList();
        return CommonResult.success(jsonObjects);
    }

    /**
     * app端申诉节点
     */
    @GetMapping("/nodeList")
    public CommonResult<Object> nodeList(@RequestParam("recordId") Integer recordId) {
        List<JSONObject> jsonObjects = examineService.nodeList(recordId);
        return CommonResult.success(jsonObjects);
    }

    /**
     * 员工端确认
     */
    @PostMapping("/confirm")
    public CommonResult<Object> confirm(@RequestBody JSONObject param) {
        Integer confirm = examineService.confirm(param);
        return CommonResult.success(confirm);
    }

    @GetMapping("/selectDealtWithNum")
    public CommonResult<Object> selectDealtWithNum() {
        JSONObject result = examineService.selectDealtWithNum();
        return success(result);
    }


}